﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpSphinx.Util.Configuration;

namespace SharpSphinx.Frontend
{
    public class GainControlProcessor : BaseDataProcessor 
    {

        public static String GAIN_FACTOR = "GainFactor";


        private double gainFactor;



        public GainControlProcessor(double gainFactor)
        {
            // Logger 
            this.gainFactor = gainFactor;
        }

        public GainControlProcessor()
        {

        }


        public override void newProperties(PropertySheet ps)
        {
          
           // gainFactor = ps.get
        }

        public override IData getData()
        {
            IData Data = getPredecessor().getData();


            if (Data is FloatData)
            {
                float[] values = ((FloatData)Data).getValues();


                if (gainFactor != 1.0)
                {
                    for (int i = 0; i < values.Length; i++)
                    {
                        values[i] *= (float)gainFactor;
                    }
                }
            }
            else if (Data is DoubleData)
            {

            }
        }


    }
}
